/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.eps.modelo.javabeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author luis
 */
@Entity
@Table(name = "T_Sector")
@NamedQueries({
    @NamedQuery(name = "Sector.findAll", query = "SELECT s FROM Sector s"),
    @NamedQuery(name = "Sector.findByTSectorID", query = "SELECT s FROM Sector s WHERE s.tSectorID = :tSectorID"),
    @NamedQuery(name = "Sector.findByDescripcion", query = "SELECT s FROM Sector s WHERE s.descripcion = :descripcion")})
public class Sector implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "T_Sector_ID")
    private Integer tSectorID;
    @Basic(optional = false)
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tSectorID")
    private List<Ruta> rutaList;
    @JoinColumn(name = "T_Distrito_ID", referencedColumnName = "T_Distrito_ID")
    @ManyToOne(optional = false)
    private Distrito tDistritoID;

    public Sector() {
    }

    public Sector(Integer tSectorID) {
        this.tSectorID = tSectorID;
    }

    public Sector(Integer tSectorID, String descripcion) {
        this.tSectorID = tSectorID;
        this.descripcion = descripcion;
    }

    public Integer getTSectorID() {
        return tSectorID;
    }

    public void setTSectorID(Integer tSectorID) {
        this.tSectorID = tSectorID;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public List<Ruta> getRutaList() {
        return rutaList;
    }

    public void setRutaList(List<Ruta> rutaList) {
        this.rutaList = rutaList;
    }

    public Distrito getTDistritoID() {
        return tDistritoID;
    }

    public void setTDistritoID(Distrito tDistritoID) {
        this.tDistritoID = tDistritoID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tSectorID != null ? tSectorID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sector)) {
            return false;
        }
        Sector other = (Sector) object;
        if ((this.tSectorID == null && other.tSectorID != null) || (this.tSectorID != null && !this.tSectorID.equals(other.tSectorID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "murguia.ejb30.entity.COMER.Sector[tSectorID=" + tSectorID + "]";
    }

}
